# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: Fabian Bornschein <fabiscafe-cat-mailbox-dog-org>

pkgname=gnome-connections
pkgver=43.0
pkgrel=1
pkgdesc='Remote desktop client for the GNOME desktop environment'
arch=('loong64' 'x86_64')
url='https://gitlab.gnome.org/GNOME/connections'
license=('GPL3')
depends=('freerdp' 'gtk-vnc' 'libhandy' 'libsecret')
makedepends=('appstream-glib' 'gobject-introspection' 'itstool' 'meson' 'vala')
groups=('gnome-extra')
options=('!emptydirs' 'debug')
source=("https://download.gnome.org/sources/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.xz")
sha256sums=('85dad82f93c0b2f609fe8ec7ecdeec70600a55612afc0e3f02774c25a0bb309f')

prepare() {
  cd $pkgname-$pkgver
  # Don't use legacy path for metainfo file
  sed -i "s/datadir'), 'appdata/datadir'), 'metainfo/" data/meson.build
  # Add categories to desktop file
  sed -i 's/Categories=GTK;/Categories=GNOME;GTK;Utility;RemoteAccess;Network;/' \
    data/org.gnome.Connections.desktop.in

}

build() {
  arch-meson $pkgname-$pkgver build
  meson compile -C build
}

check() {
  meson test -C build --print-errorlogs
}

package() {
  meson install -C build --destdir "$pkgdir"

  # Remove unneeded development files
  rm -r "$pkgdir"/usr/include/gnome-connections/gtk-frdp \
        "$pkgdir"/usr/lib/gnome-connections/{girepository-1.0,pkgconfig} \
        "$pkgdir"/usr/share/gnome-connections/{gir-1.0,vapi}
}
